<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>sigwaitinfo</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_008_768">&nbsp;</a>NAME</h4><blockquote>
sigwaitinfo, sigtimedwait - wait for queued signals
(<b>REALTIME</b>)
</blockquote><h4><a name = "tag_000_008_769">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="signal.h.html">signal.h</a>&gt;

int sigwaitinfo(const sigset_t *<i>set</i>, siginfo_t *<i>info</i>);
int sigtimedwait(const sigset_t *<i>set</i>, siginfo_t *<i>info</i>,
    const struct timespec *<i>timeout</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_008_770">&nbsp;</a>DESCRIPTION</h4><blockquote>
The function
<i>sigwaitinfo()</i>
selects the pending signal from the set specified by
<i>set</i>.
Should any of multiple pending signals in the range
SIGRTMIN to SIGRTMAX be selected,
it will be the lowest numbered one.
The selection order between realtime and non-realtime signals,
or between multiple pending non-realtime signals, is unspecified.
If no signal in
<i>set</i>
is pending at the time of the call,
the calling thread is suspended until one or more signals in
<i>set</i>
become pending or until it is interrupted by an unblocked, caught signal.
<p>
The function
<i>sigwaitinfo()</i>
behaves the same as the
<i><a href="sigwait.html">sigwait()</a></i>
function if the
<i>info</i>
argument is NULL.
If the
<i>info</i>
argument is non-NULL, the
<i>sigwaitinfo()</i>
function behaves the same as
<i>sigwait,</i>()
except that the selected signal number is stored in the
<i>si_signo</i>
member, and the cause of the signal is stored in the
<i>si_code</i>
member.
If any value is queued to the selected
signal, the first such queued value is 
dequeued and, if the
<i>info</i>
argument is non-NULL, the value is stored in the
<i>si_value</i>
member of
<i>info</i>.
The system resource used to queue the signal will be released
and made available to queue other signals.
If no value is queued, the
content of the
<i>si_value</i>
member is undefined.
If no further signals
are queued for the selected signal,
the pending indication for that signal will be reset.
<p>
The function
<i>sigtimedwait()</i>
behaves the same as
<i>sigwaitinfo()</i>
except that if none of the signals specified by
<i>set</i>
are pending,
<i>sigtimedwait()</i>
waits for the time interval specified in the
<b>timespec</b>
structure referenced by
<i>timeout</i>.
If the
<b>timespec</b>
structure pointed to by
<i>timeout</i>
is zero-valued and if none of the signals specified by
<i>set</i>
are pending, then
<i>sigtimedwait()</i>
returns immediately with an error.
If
<i>timeout</i>
is the NULL pointer, the behaviour is unspecified.
</blockquote><h4><a name = "tag_000_008_771">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion (that is, one of
the signals specified by
<i>set</i>
is pending or is generated)
<i>sigwaitinfo()</i>
and
<i>sigtimedwait()</i>
will return the selected signal number.
Otherwise, the function returns a value of -1 and sets
<i>errno</i>
to indicate the error.
</blockquote><h4><a name = "tag_000_008_772">&nbsp;</a>ERRORS</h4><blockquote>
The 
<i>sigwaitinfo()</i>
and
<i>sigtimedwait()</i>
functions will fail if:
<dl compact>

<dt>[ENOSYS]<dd>
The functions
<i>sigwaitinfo()</i>
and
<i>sigtimedwait()</i>
are not supported by this implementation.

</dl>
<p>
The 
<i>sigtimedwait()</i>
function will also fail if:
<dl compact>

<dt>[EAGAIN]<dd>
No signal specified by
<i>set</i>
was generated within the specified timeout period.

</dl>
<p>
The 
<i>sigwaitinfo()</i>
and
<i>sigtimedwait()</i>
functions may fail if:
<dl compact>

<dt>[EINTR]<dd>
The wait was interrupted by an unblocked, caught signal.
It will be documented in system documentation whether this error will
cause these functions to fail.

</dl>
<br>
<p>
The
<i>sigtimedwait()</i>
function may also fail if:
<dl compact>

<dt>[EINVAL]<dd>
The
<i>timeout</i>
argument specified a
<i>tv_nsec</i>
value less than zero or greater than or equal to 1000 million.

</dl>
<p>
An implementation only checks for this error if no signal is
pending in
<i>set</i>
and it is necessary to wait.
</blockquote><h4><a name = "tag_000_008_773">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_008_774">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_008_775">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_008_776">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="pause.html">pause()</a></i>,
<i><a href="pthread_sigmask.html">pthread_sigmask()</a></i>,
<i><a href="sigaction.html">sigaction()</a></i>,
<i><a href="signal.h.html">&lt;signal.h&gt;</a></i>,
<i><a href="sigpending.html">sigpending()</a></i>,
<i><a href="sigsuspend.html">sigsuspend()</a></i>,
<i><a href="sigwait.html">sigwait()</a></i>,
<i><a href="time.h.html">&lt;time.h&gt;</a></i>.
</blockquote><h4>DERIVATION</h4><blockquote>
Derived from the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995) and the POSIX Threads Extension (1003.1c-1995)
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>

